UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CDEplcNk2BB66uB+NTPJiAGUy6AYxqmP3bPodHKcTPY=' 
WHERE 
  key_id = '44370b8be72283858d9904d768c34e5f6825b998a634762ffba6316b0ec142aa' 
  AND (
    token = 'CDEplcNk2BB66uB+NTPJiAGUy6AYxqmP3bPodHKcTPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035