UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L6Rj5dRpcv3IzXBU2HGzY9olFFTdo1mKztz20imLI6Y=' 
WHERE 
  key_id = '682dc12628f5f0adaca2979941e1d1f0553e5b433dbf39830ad1dfc8a0505925' 
  AND (
    token = 'L6Rj5dRpcv3IzXBU2HGzY9olFFTdo1mKztz20imLI6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054