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

Query time 0.00036