UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gRxHdQ7dVUapC+tGxN3lfKOGsGSGqstvAetRzFYnfJ4=' 
WHERE 
  key_id = '14ba0728d6902565ce04c981baada32f55cda862d2aeb2924752f401be2ec122' 
  AND (
    token = 'gRxHdQ7dVUapC+tGxN3lfKOGsGSGqstvAetRzFYnfJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032