UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ENUGCBehaM/tl1kJeKewO2gck3zqelojNRcIkKaIMc=' 
WHERE 
  key_id = '6577eee10ef35108febed71c34a4ec2530930aa6199b0b0996aaa124bb3be163' 
  AND (
    token = '8ENUGCBehaM/tl1kJeKewO2gck3zqelojNRcIkKaIMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032