UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gyt7yqBjkEIP1KAnQI5NCLT6CIRKyduo9jDNQC6kNGA='
WHERE
key_id = '5590be569950eac386ba43f9dff2bddf5e228becadb0d200674e5c8732307608'
AND (
token = 'gyt7yqBjkEIP1KAnQI5NCLT6CIRKyduo9jDNQC6kNGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)