UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CHyS45X79auyzB5vnYt9jZ2n7sTO8cmDGcIe+DB7CCQ='
WHERE
key_id = 'cb7dc55012ff283736a605271abd6467f2ffdb28484b0b37f1532a13892b7ebe'
AND (
token = 'CHyS45X79auyzB5vnYt9jZ2n7sTO8cmDGcIe+DB7CCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)