UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YYhQCeKD2hn2dtBVlKkYcA9YmFRjUh03K20XkxXc5XY='
WHERE
key_id = 'c7e040a760232e93f30620950bddb142b6a0a44f3a4add2962cf8b324b7f0416'
AND (
token = 'YYhQCeKD2hn2dtBVlKkYcA9YmFRjUh03K20XkxXc5XY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)