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