UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gWAlI3eLVdZpq3/BhIJjjUQSCG+PI6wwXhO3aayRS1w='
WHERE
key_id = '69552d8f9bbb7667140c940c8f5f4a2d124aa3f934756fb534b58d8be5dc5dae'
AND (
token = 'gWAlI3eLVdZpq3/BhIJjjUQSCG+PI6wwXhO3aayRS1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)