UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jWf2g2uDyN/ANh02q/krk4qQiNsOZTqPzTqUVvaSuh0='
WHERE
key_id = 'd48e0d88e90c8794d2dc1d870e32fb4ca2a2bc9a7e8df18277f8d0fb27886f23'
AND (
token = 'jWf2g2uDyN/ANh02q/krk4qQiNsOZTqPzTqUVvaSuh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)