UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CK0DdWGdg5nnBhnPV7Toiswrc+muVKa6yI6ai3o+TQg=' 
WHERE 
  key_id = '08d6b942302ab8638f0d5f104f534eb7666cff284f91116fe234806d1a51ed38' 
  AND (
    token = 'CK0DdWGdg5nnBhnPV7Toiswrc+muVKa6yI6ai3o+TQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023