UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmV6eIASDngkiGVBSbnH5kyl9Q122pdYtjM+ozZURUE='
WHERE
key_id = '7f2b244a7b554056b13d033e3ff7d915964d690cb2e44f54320416d46691c9a4'
AND (
token = 'tmV6eIASDngkiGVBSbnH5kyl9Q122pdYtjM+ozZURUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)