UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JmX1OYXGuyaR7x0UJO7sTT6rLPFLylpitld/PLAwj08='
WHERE
key_id = 'c694a4e62eb7b882bd3f998afc20a208ee8b50f0bfd2b0a5e0d4d798466b02c1'
AND (
token = 'JmX1OYXGuyaR7x0UJO7sTT6rLPFLylpitld/PLAwj08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)