UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '11RsgoqZyo5CMiiXCrEcBSyx+a+UJFOypboXi8Fb3Hc=' 
WHERE 
  key_id = '657ad12aefce778feb5d540193fcc4e65c0cb686276586ea05cad02d095d17c6' 
  AND (
    token = '11RsgoqZyo5CMiiXCrEcBSyx+a+UJFOypboXi8Fb3Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032