UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8RNKD2ksAelkRgr1zlcNKm28/4TyJew/QDRMx8ROiE=' 
WHERE 
  key_id = '2b1c5190213d6516a38853d4016c685496be23abd3ee1ed173a475ca0a59fc1d' 
  AND (
    token = 'J8RNKD2ksAelkRgr1zlcNKm28/4TyJew/QDRMx8ROiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051