UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q5CjMcLrFlt8+qX/b4guRiP7O5vvW8gl1yZOj9btOJ8='
WHERE
key_id = 'b99e507952e6932d97732ed323356eb3e19fd0bf82ac8640b56f32fce2a8266e'
AND (
token = 'q5CjMcLrFlt8+qX/b4guRiP7O5vvW8gl1yZOj9btOJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)