UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7btrp107hRlzUVeOOXjYXYKZja6rxj4LfYRoGF3nLV0='
WHERE
key_id = '6a6cd1cc0b507b36cf05662f4896030a5b42e440d5cee8c3b4e6213171513cfe'
AND (
token = '7btrp107hRlzUVeOOXjYXYKZja6rxj4LfYRoGF3nLV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)