UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lPFRh0/0upYDpudhl/OuuR+BQ1dENm1BEhfHTh+yjVc='
WHERE
key_id = 'ddf0b040f2f7caebada0e0144dceedfdbd3e5c7b7bb4315e0a57842b1f249e8d'
AND (
token = 'lPFRh0/0upYDpudhl/OuuR+BQ1dENm1BEhfHTh+yjVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)