UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D4SY09siAF9w+mKaYVa2VfEZOWKDZ1bUGqkyp5pWOds='
WHERE
key_id = 'e0ec85456f67ded8513c7c78be369fdf7b4621e1b12141de5a5b64932e80c251'
AND (
token = 'D4SY09siAF9w+mKaYVa2VfEZOWKDZ1bUGqkyp5pWOds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)