UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0JJ9/QbRaPiCoAakZQ3msQJn2qVADVZ4QlL6WkB/CVw='
WHERE
key_id = 'f854b202be43d0c72529a95af9c17083086b447a632df8687bc12a93e508198f'
AND (
token = '0JJ9/QbRaPiCoAakZQ3msQJn2qVADVZ4QlL6WkB/CVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)