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