UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pr/0Z27pKDQ655HDZJ7vyhPXRKPtu1B76hmoUx//NXw=' 
WHERE 
  key_id = '383486c28e2288fef73d6530edcd9341d53040a53d4d335eb1a8fcead63bb6bb' 
  AND (
    token = 'pr/0Z27pKDQ655HDZJ7vyhPXRKPtu1B76hmoUx//NXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023