UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RuW5kwIXF62M9OuLJfoPfBvWmMlWU816YHrk/fzcb80='
WHERE
key_id = 'af287d54d0eee0ce80c88180e1062cc07ed346cbd303b8ba2ab1a26dabe97b86'
AND (
token = 'RuW5kwIXF62M9OuLJfoPfBvWmMlWU816YHrk/fzcb80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)