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

Query time 0.00040