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