UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b8VBZSOeoErs8Y/Tgb6pvxpsSRwkg5akx8Zte4UGB7I=' 
WHERE 
  key_id = '1452f9840eeacb0643673979d77fc139508358bce67bd773e1cdd69c40460c54' 
  AND (
    token = 'b8VBZSOeoErs8Y/Tgb6pvxpsSRwkg5akx8Zte4UGB7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031