UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bi9q3kNq5QwDFcZ5qN6K2dQF9D7vp7/9HZVTkMJoEu8='
WHERE
key_id = 'ccc5c035db3242670ca99a3cd361992a11de2ad820d359f99df5f791c5b91585'
AND (
token = 'Bi9q3kNq5QwDFcZ5qN6K2dQF9D7vp7/9HZVTkMJoEu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)