UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JAmjwjo8WHm3KkcOOyi+SNlrthJ4en+lGNjyT4qM6KM='
WHERE
key_id = 'e1caca017ac5c39cb31ab0178db4054aecd7d9e57d3232b23c72843678ac4fd7'
AND (
token = 'JAmjwjo8WHm3KkcOOyi+SNlrthJ4en+lGNjyT4qM6KM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)