UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6alibabt0dOB0hGTNL2PB0YfAfxkfIDC3UoqqRJPtIM='
WHERE
key_id = 'e1ae8bee3a956d9e0a8a458a758f11ef56bb333fddac4d1995fb500e5f3ebdd0'
AND (
token = '6alibabt0dOB0hGTNL2PB0YfAfxkfIDC3UoqqRJPtIM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)