UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CFhkiDVpnGiPoG6+sKca9+J9fv4pa9bTJgD5fTzk8Ws='
WHERE
key_id = 'c9fc8fac4cea158bb93875795c771d66fc9f141d696727f64c2b6bfae8fdb370'
AND (
token = 'CFhkiDVpnGiPoG6+sKca9+J9fv4pa9bTJgD5fTzk8Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)