UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6bnpAnYPNaosK4trbWq24LsVlIeg2NuxD3IH075q22w=' 
WHERE 
  key_id = '344e460854b1d1d8c913feddb47b61595c6c7494ec79c3535bdb9faba24b05e1' 
  AND (
    token = '6bnpAnYPNaosK4trbWq24LsVlIeg2NuxD3IH075q22w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036