UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TSflj3M3BNu40fyrDr3NAf9jzuYO80rvMMbojcEXcvc=' 
WHERE 
  key_id = 'a4dd3adabec128b7172bb4ce37992f9a00e773e921b2e50ddb2162f155adc6a9' 
  AND (
    token = 'TSflj3M3BNu40fyrDr3NAf9jzuYO80rvMMbojcEXcvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035