UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YxwRZG3KRH12kR5JEY9R80GV3hbu3ku0l6xCroRuDlw='
WHERE
key_id = 'a1bbec7bc97e079d676fe16473cb305ba00812fdde03967a766aebe04208a89b'
AND (
token = 'YxwRZG3KRH12kR5JEY9R80GV3hbu3ku0l6xCroRuDlw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)