UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vJf/+d/LjQsTP0mRK1lK9niKBy/KY8TcEK3My/gB/Ig=' 
WHERE 
  key_id = 'e3d774d9a45554ceb274d1c8fab2602676bdecb7fe987faacb8794051c788aff' 
  AND (
    token = 'vJf/+d/LjQsTP0mRK1lK9niKBy/KY8TcEK3My/gB/Ig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035