UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XouAJbBn8dfl/UJktY7wuDsV5RuGhmSfS8r2BwIrCJs='
WHERE
key_id = 'b6ded16ca84c2173d51052ff712a159587f5040d458c394ef988a2f27418598d'
AND (
token = 'XouAJbBn8dfl/UJktY7wuDsV5RuGhmSfS8r2BwIrCJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)